const { defineConfig } = require('@vue/cli-service')
const path = require('path')

module.exports = defineConfig({
  transpileDependencies: true,
  configureWebpack: {
    resolve: {
      alias: {
        '@': path.resolve(__dirname, 'src')
      }
    }
  },
  devServer: {
    port: 8080,
    proxy: {
      '^/api': {
        target: 'http://localhost:5009',
        changeOrigin: true
      },
      '^/Comments': {
        target: 'http://localhost:5009',
        changeOrigin: true,
        pathRewrite: {
          '^/Comments': '/api/Comments'
        }
      },
      '^/Interactions': {
        target: 'http://localhost:5009',
        changeOrigin: true,
        pathRewrite: {
          '^/Interactions': '/api/Interactions'
        }
      },
      '^/Products': {
        target: 'http://localhost:5009',
        changeOrigin: true,
        pathRewrite: {
          '^/Products': '/api/Products'
        }
      },
      '^/Orders': {
        target: 'http://localhost:5009',
        changeOrigin: true,
        pathRewrite: {
          '^/Orders': '/api/Orders'
        }
      },
      '^/Users': {
        target: 'http://localhost:5009',
        changeOrigin: true,
        pathRewrite: {
          '^/Users': '/api/Users'
        }
      },
      '^/Log': {
        target: 'http://localhost:5009',
        changeOrigin: true,
        pathRewrite: {
          '^/Log': '/api/Log'
        }
      },
      '^/Messages': {
        target: 'http://localhost:5009',
        changeOrigin: true,
        pathRewrite: {
          '^/Messages': '/api/Messages'
        }
      },
      '^/ProductCategory': {
        target: 'http://localhost:5009',
        changeOrigin: true,
        pathRewrite: {
          '^/ProductCategory': '/api/ProductCategory'
        }
      }
    }
  }
})
